package com.google.tts;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class ConfigurationManager extends Activity
{
  public static boolean allFilesExist()
  {
    String[] arrayOfString = new String[171];
    arrayOfString[0] = "af_dict";
    arrayOfString[1] = "config";
    arrayOfString[2] = "cs_dict";
    arrayOfString[3] = "cy_dict";
    arrayOfString[4] = "de_dict";
    arrayOfString[5] = "el_dict";
    arrayOfString[6] = "en_dict";
    arrayOfString[7] = "eo_dict";
    arrayOfString[8] = "es_dict";
    arrayOfString[9] = "fi_dict";
    arrayOfString[10] = "fr_dict";
    arrayOfString[11] = "grc_dict";
    arrayOfString[12] = "hbs_dict";
    arrayOfString[13] = "hi_dict";
    arrayOfString[14] = "hu_dict";
    arrayOfString[15] = "id_dict";
    arrayOfString[16] = "is_dict";
    arrayOfString[17] = "it_dict";
    arrayOfString[18] = "jbo_dict";
    arrayOfString[19] = "ku_dict";
    arrayOfString[20] = "la_dict";
    arrayOfString[21] = "mk_dict";
    arrayOfString[22] = "nl_dict";
    arrayOfString[23] = "no_dict";
    arrayOfString[24] = "phondata";
    arrayOfString[25] = "phonindex";
    arrayOfString[26] = "phontab";
    arrayOfString[27] = "pl_dict";
    arrayOfString[28] = "pt_dict";
    arrayOfString[29] = "ro_dict";
    arrayOfString[30] = "ru_dict";
    arrayOfString[31] = "sk_dict";
    arrayOfString[32] = "sv_dict";
    arrayOfString[33] = "sw_dict";
    arrayOfString[34] = "ta_dict";
    arrayOfString[35] = "tr_dict";
    arrayOfString[36] = "vi_dict";
    arrayOfString[37] = "zh_dict";
    arrayOfString[38] = "zhy_dict";
    arrayOfString[39] = "mbrola/dummyfile";
    arrayOfString[40] = "mbrola_ph/af1_phtrans";
    arrayOfString[41] = "mbrola_ph/ca1_phtrans";
    arrayOfString[42] = "mbrola_ph/cr1_phtrans";
    arrayOfString[43] = "mbrola_ph/cs_phtrans";
    arrayOfString[44] = "mbrola_ph/de2_phtrans";
    arrayOfString[45] = "mbrola_ph/de4_phtrans";
    arrayOfString[46] = "mbrola_ph/de6_phtrans";
    arrayOfString[47] = "mbrola_ph/en1_phtrans";
    arrayOfString[48] = "mbrola_ph/es_phtrans";
    arrayOfString[49] = "mbrola_ph/es4_phtrans";
    arrayOfString[50] = "mbrola_ph/fr1_phtrans";
    arrayOfString[51] = "mbrola_ph/gr2_phtrans";
    arrayOfString[52] = "mbrola_ph/grc-de6_phtrans";
    arrayOfString[53] = "mbrola_ph/hu1_phtrans";
    arrayOfString[54] = "mbrola_ph/id1_phtrans";
    arrayOfString[55] = "mbrola_ph/in1_phtrans";
    arrayOfString[56] = "mbrola_ph/it3_phtrans";
    arrayOfString[57] = "mbrola_ph/la1_phtrans";
    arrayOfString[58] = "mbrola_ph/nl_phtrans";
    arrayOfString[59] = "mbrola_ph/pl1_phtrans";
    arrayOfString[60] = "mbrola_ph/pt_phtrans";
    arrayOfString[61] = "mbrola_ph/ptbr_phtrans";
    arrayOfString[62] = "mbrola_ph/ptbr4_phtrans";
    arrayOfString[63] = "mbrola_ph/ro1_phtrans";
    arrayOfString[64] = "mbrola_ph/sv_phtrans";
    arrayOfString[65] = "mbrola_ph/sv2_phtrans";
    arrayOfString[66] = "mbrola_ph/us_phtrans";
    arrayOfString[67] = "mbrola_ph/us3_phtrans";
    arrayOfString[68] = "soundicons/dummyfile";
    arrayOfString[69] = "voices/af";
    arrayOfString[70] = "voices/bs";
    arrayOfString[71] = "voices/cs";
    arrayOfString[72] = "voices/cy";
    arrayOfString[73] = "voices/de";
    arrayOfString[74] = "voices/default";
    arrayOfString[75] = "voices/el";
    arrayOfString[76] = "voices/eo";
    arrayOfString[77] = "voices/es";
    arrayOfString[78] = "voices/es-la";
    arrayOfString[79] = "voices/fi";
    arrayOfString[80] = "voices/fr";
    arrayOfString[81] = "voices/fr-be";
    arrayOfString[82] = "voices/grc";
    arrayOfString[83] = "voices/hi";
    arrayOfString[84] = "voices/hr";
    arrayOfString[85] = "voices/hu";
    arrayOfString[86] = "voices/id";
    arrayOfString[87] = "voices/is";
    arrayOfString[88] = "voices/it";
    arrayOfString[89] = "voices/jbo";
    arrayOfString[90] = "voices/ku";
    arrayOfString[91] = "voices/la";
    arrayOfString[92] = "voices/mk";
    arrayOfString[93] = "voices/nl";
    arrayOfString[94] = "voices/no";
    arrayOfString[95] = "voices/pl";
    arrayOfString[96] = "voices/pt";
    arrayOfString[97] = "voices/pt-pt";
    arrayOfString[98] = "voices/ro";
    arrayOfString[99] = "voices/ru";
    arrayOfString[100] = "voices/sk";
    arrayOfString[101] = "voices/sr";
    arrayOfString[102] = "voices/sv";
    arrayOfString[103] = "voices/sw";
    arrayOfString[104] = "voices/ta";
    arrayOfString[105] = "voices/tr";
    arrayOfString[106] = "voices/vi";
    arrayOfString[107] = "voices/zh";
    arrayOfString[108] = "voices/zhy";
    arrayOfString[109] = "voices/!v/croak";
    arrayOfString[110] = "voices/!v/f1";
    arrayOfString[111] = "voices/!v/f2";
    arrayOfString[112] = "voices/!v/f3";
    arrayOfString[113] = "voices/!v/f4";
    arrayOfString[114] = "voices/!v/m1";
    arrayOfString[115] = "voices/!v/m2";
    arrayOfString[116] = "voices/!v/m3";
    arrayOfString[117] = "voices/!v/m4";
    arrayOfString[118] = "voices/!v/m5";
    arrayOfString[119] = "voices/!v/m6";
    arrayOfString[120] = "voices/!v/whisper";
    arrayOfString[121] = "voices/en/en";
    arrayOfString[122] = "voices/en/en-n";
    arrayOfString[123] = "voices/en/en-r";
    arrayOfString[124] = "voices/en/en-rp";
    arrayOfString[125] = "voices/en/en-sc";
    arrayOfString[126] = "voices/en/en-wi";
    arrayOfString[127] = "voices/en/en-wm";
    arrayOfString[128] = "voices/mb/mb-af1";
    arrayOfString[129] = "voices/mb/mb-af1-en";
    arrayOfString[130] = "voices/mb/mb-br1";
    arrayOfString[131] = "voices/mb/mb-br3";
    arrayOfString[132] = "voices/mb/mb-br4";
    arrayOfString[133] = "voices/mb/mb-cr1";
    arrayOfString[134] = "voices/mb/mb-cz2";
    arrayOfString[135] = "voices/mb/mb-de2";
    arrayOfString[136] = "voices/mb/mb-de4";
    arrayOfString[137] = "voices/mb/mb-de4-en";
    arrayOfString[138] = "voices/mb/mb-de5";
    arrayOfString[139] = "voices/mb/mb-de5-en";
    arrayOfString[140] = "voices/mb/mb-de6";
    arrayOfString[141] = "voices/mb/mb-de6-grc";
    arrayOfString[142] = "voices/mb/mb-de7";
    arrayOfString[143] = "voices/mb/mb-en1";
    arrayOfString[144] = "voices/mb/mb-es1";
    arrayOfString[145] = "voices/mb/mb-es2";
    arrayOfString[146] = "voices/mb/mb-fr1";
    arrayOfString[147] = "voices/mb/mb-fr1-en";
    arrayOfString[148] = "voices/mb/mb-fr4";
    arrayOfString[149] = "voices/mb/mb-fr4-en";
    arrayOfString[150] = "voices/mb/mb-gr2";
    arrayOfString[151] = "voices/mb/mb-gr2-en";
    arrayOfString[152] = "voices/mb/mb-hu1";
    arrayOfString[153] = "voices/mb/mb-hu1-en";
    arrayOfString[154] = "voices/mb/mb-id1";
    arrayOfString[155] = "voices/mb/mb-it3";
    arrayOfString[156] = "voices/mb/mb-it4";
    arrayOfString[157] = "voices/mb/mb-la1";
    arrayOfString[158] = "voices/mb/mb-nl2";
    arrayOfString[159] = "voices/mb/mb-nl2-en";
    arrayOfString[160] = "voices/mb/mb-pl1";
    arrayOfString[161] = "voices/mb/mb-pl1-en";
    arrayOfString[162] = "voices/mb/mb-ro1";
    arrayOfString[163] = "voices/mb/mb-ro1-en";
    arrayOfString[164] = "voices/mb/mb-sw1";
    arrayOfString[165] = "voices/mb/mb-sw1-en";
    arrayOfString[166] = "voices/mb/mb-sw2";
    arrayOfString[167] = "voices/mb/mb-sw2-en";
    arrayOfString[168] = "voices/mb/mb-us1";
    arrayOfString[169] = "voices/mb/mb-us2";
    arrayOfString[170] = "voices/mb/mb-us3";
    int k;
    if (!(new File("/sdcard/espeak-data/").isDirectory()))
    {
      k = 0;
      return k;
    }
    for (int i = 0; ; ++i)
    {
      if (i >= arrayOfString.length)
        k = 1;
      if (new File("/sdcard/espeak-data/" + arrayOfString[i]).exists())
        continue;
      for (int j = 0; ; ++j)
      {
        if (j >= arrayOfString.length)
          k = 0;
        new File("/sdcard/espeak-data/" + arrayOfString[j]).delete();
      }
    }
  }

  public static void downloadEspeakData()
  {
    ZipFile localZipFile;
    ZipEntry localZipEntry;
    while (true)
    {
      FileOutputStream localFileOutputStream1;
      byte[] arrayOfByte1;
      int i;
      try
      {
        if (!(new File("/sdcard/").canWrite()))
          return;
        File localFile1 = new File("/sdcard/espeak-data/");
        localFile1.mkdir();
        URLConnection localURLConnection = new URL(new URL(new URL("http://eyes-free.googlecode.com/svn/trunk/thirdparty/espeak-data.zip"), "http://eyes-free.googlecode.com/svn/trunk/thirdparty/espeak-data.zip").toString()).openConnection();
        localURLConnection.connect();
        InputStream localInputStream1 = localURLConnection.getInputStream();
        File localFile2 = new File("/sdcard/espeak-data/data.zip");
        localFile2.createNewFile();
        localFileOutputStream1 = new FileOutputStream(localFile2);
        arrayOfByte1 = new byte[16384];
        i = localInputStream1.read(arrayOfByte1);
        if (i > 0)
          break label232;
        localInputStream1.close();
        localFileOutputStream1.close();
        localZipFile = new ZipFile("/sdcard/espeak-data/data.zip");
        Enumeration localEnumeration = localZipFile.entries();
        if (!(localEnumeration.hasMoreElements()))
          return;
        localZipEntry = (ZipEntry)localEnumeration.nextElement();
        if (!(localZipEntry.isDirectory()))
          break label245;
        new File(localFile1 + localZipEntry.getName()).mkdir();
      }
      catch (IOException localIOException)
      {
        localIOException.printStackTrace();
      }
      return;
      label232: localFileOutputStream1.write(arrayOfByte1, 0, i);
    }
    label245: InputStream localInputStream2 = localZipFile.getInputStream(localZipEntry);
    String str1 = localZipEntry.getName();
    String str2 = new File("/sdcard/espeak-data/" + str1).getCanonicalPath();
    String str3 = str2.substring(1 + str2.lastIndexOf("/"));
    String str4 = str2.substring(0, str2.lastIndexOf("/"));
    new File(str4).mkdirs();
    File localFile3 = new File(str4, str3);
    localFile3.createNewFile();
    FileOutputStream localFileOutputStream2 = new FileOutputStream(localFile3);
    byte[] arrayOfByte2 = new byte[16384];
    while (true)
    {
      int j = localInputStream2.read(arrayOfByte2);
      if (j <= 0)
      {
        localInputStream2.close();
        localFileOutputStream2.close();
      }
      localFileOutputStream2.write(arrayOfByte2, 0, j);
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    if (!(allFilesExist()))
    {
      setContentView(2130903040);
      new Thread(new dataDownloader()).start();
    }
    while (true)
    {
      return;
      startActivityForResult(new Intent(this, PrefsActivity.class), 42);
      finish();
    }
  }

  public class dataDownloader
    implements Runnable
  {
    public void run()
    {
      ConfigurationManager.downloadEspeakData();
      ConfigurationManager.this.finish();
    }
  }
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     com.google.tts.ConfigurationManager
 * JD-Core Version:    0.5.3
 */